/*
 * @Description: 多页签
 * @Author: wangfuwei
 * @Date: 2020-12-06 22:45:54
 * @LastEditors: wangfuwei
 * @LastEditTime: 2020-12-07 14:37:55
 * @FilePath: /horizon-frontend/src/components/MultiTab/index.js
 */
import events from "./events";
import MultiTab from "./MultiTab";

const api = {
  /**
   * open new tab on route fullPath
   * @param tabKey
   */
  open: function(tabKey) {
    events.$emit("open", tabKey);
  },

  /**
   * close route fullPath tab
   * @param tabKey
   */
  close: function(tabKey) {
    events.$emit("close", tabKey);
  },
};

MultiTab.install = function(Vue) {
  if (Vue.prototype.$multiTab) {
    return;
  }
  api.instance = events;
  Vue.prototype.$multiTab = api;
  Vue.component("multi-tab", MultiTab);
};

export default MultiTab;
